<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class AdminBrandRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'required|min:3|max:20',
            'site_url' => 'required|url',
            'desc' => 'required|max:50',
        ];
    }



    public function messages()
    {
        return [
            'name.required' => '品牌名称不能为空',
            'name.min' => '品牌名称不能小于3个字符',
            'name.max' => '品牌名称不能超出20个字符',
            'site_url.required' => '品牌的URL不能为空',
            'site_url.url' => '品牌URL的填写格式不正确',
            'desc.required' => '品牌简介不能为空',
            'desc.max' => '品牌简介不能超过50个字符',
        ];
    }
}
